package com.guochuang.yunwang.promanager.dao;

import com.guochuang.yunwang.promanager.domain.User;
import com.guochuang.yunwang.promanager.domain.vo.UserSearchVO;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;

import java.util.List;
import java.util.Set;

@Repository
public interface UserMapper {
    /**
     * 根据用户id查询用户信息
     * @param uid
     * @return
     */
    User findUserByUID(Integer uid);

    /**
     * 根据用户姓名查询用户信息
     * @param username
     * @return
     */
    User findUserByName(String username);

    /**
     * 根据手机号码查询用户信息
     * @param phonenum
     * @return
     */
    User findUserByPhoneNum(String phonenum);
    /**
     * 根据账户查询用户信息
     * @param account
     * @return
     */
    User findUserByAccount(String account);

    /**
     * 查询出所有用户
     */
    List<User> findAllUsers();


    /**
     * 根据uid删除用户
     * @param uid
     * @return
     */
    Integer delUserByUID(Integer uid);

    /**
     *更新用户信息
     * @param user
     * @return
     */
    Integer updateUser(User user);

    /**
     * 添加用户
     */
    Integer addUser(User user);

    Integer delUserByUids(List<Integer> uids);

    List<User> searchUserByParams(UserSearchVO uservo);

    Set<String> selectPermissions(Integer uid);

    Integer delUserRoleByUid(Integer uid);

    Integer insertUserRoles(@Param(value = "uid") Integer uid,
                            @Param(value = "roles") List<Integer> rolse);

    /**
     * 根据用户的id修改用户的头像
     * @param uid
     * @param headImg
     * @return
     */
    Integer updateUserAvatorByUid(@Param(value = "uid") Integer uid,
                                  @Param(value = "headImg") String headImg);
}
